import request from "@/utils/request"
enum API {
    LOGINKEY = '/login/qr/key',
    LOGINKETIMG = '/login/qr/create',
    LOGINSTATUS = '/login/status',
    CHECKSTATUS = '/login/qr/check',
    USERFOLLOWS = '/user/follows',
    USEREVENT = '/user/event',
    USERFOLLOWEDS = '/user/followeds',
    USERLOGOUT = '/logout',
    USERMESSAGE = '/msg/private'
}

export const reqLoginKey = ()=>request.get<any,any>(API.LOGINKEY)
export const reqLoginKeyImg = (key:string)=>request.get<any,any>(`${API.LOGINKETIMG}?key=${key}&qrimg=true&timestamp=${Date.now()}`)
export const reqLoginStatus = (cookie:any)=>request.post<any,any>(`${API.LOGINSTATUS}?timestamp=${Date.now(),cookie}`)
export const reqCheckStatus = (key:string)=>request.get<any,any>(`${API.CHECKSTATUS}?key=${key}&timestamp=${Date.now()}&noCookie=true`)
export const reqUserFollows = (uid:string)=>request.post<any,any>(`${API.USERFOLLOWS}?uid=${uid}`)
export const reqUserEvent = (uid:string)=>request.post<any,any>(`${API.USEREVENT}?uid=${uid}`)
export const reqUserFolloweds = (uid:string)=>request.post<any,any>(`${API.USERFOLLOWEDS}?uid=${uid}`)
export const reqLogout = ()=>request.get<any,any>(API.USERLOGOUT)
export const reqUserMessage = (number:number)=>request.get<any,any>(`${API.USERMESSAGE}?limit=${number}`)